Skip to content

fix(agc): start a new native multisample depth owner when an overwriting draw binds a published owner under pending storage units - #17890

Merged
oneandonlydean merged 7 commits into
boykopovar:mainfrom
hugodearaujo:fix/agc-new-owner-under-pending-units
Nov 14, 2026
Merged

oneandonlydean merged 7 commits into
boykopovar:mainfrom
hugodearaujo:fix/agc-new-owner-under-pending-units

Conversation

@hugodearaujo

@hugodearaujo hugodearaujo commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What

Assassin's Creed Mirage (PPSA13960) stops before its title screen, at 73-81 s:

compute shader 0x1000810a00: AGC graphics: native multisample depth publication over pending storage image writes is not implemented

The target is a 4-sample D32S8 depth target without HTILE (960x540 in our logs). #16363's overwrite proof imports it, and its samples are then published to guest memory. After that the host doesn't write it. A compute pass then writes an R11G11B10F storage image at the same base, so storage units stay pending over the depth plane. The next frame binds the target again with a draw that writes every sample (depth ALWAYS with writes, stencil ALWAYS/REPLACE, mask 0xff). That bind finds the published owner and reuses it. Once the draw writes the owner, its next publication meets the pending units and throws the message above.

On the console the target and the storage image are the same memory, and that draw overwrites every sample. So no sample of the old owner survives, and the storage results are just the memory under the new draw.

The change. DepthSurfaceViewWithStencilWriteIntent now starts a new owner when all three of these hold:

The old owner is marked inactive and its depth guards are removed. It isn't host-written, so releaseRetired (#15300) frees it when the new owner is created. The new owner imports guest memory as any new owner does, and its import stores the pending results first. Its planes are then uneven, so #16363's proof decides after the draw, as for any other overwriting first draw.

Nothing else changes:

  • a bind without that draw still reuses the published owner, and its publication still refuses;
  • an owner written since its publication is reused as before;
  • an owner with no pending units over its planes is reused as before.

The depth surface debt entry, which lists when a published owner is released and a new one imported, now names this case too.

Cost: one new owner per such bind, so one overwrite proof (#16363: a recorder sync and a stencil readback). The released owner is freed at once (#15300). In Mirage (two 300 s runs of a local logging build), this path starts a new owner in two bursts, for 960x540 x4 targets, and never between them:

  • 9 and 14 new owners for one target (depth 0x10db960000) at 50-70 s, around where the build without this change stops;
  • from 251-261 s on, in the opening scene after Full Synchronization Off: one more for that target, then 24 and 41 for another (depth 0x10dfd20000). That is about one new owner per presented frame (12 new owners against 12 presents in each of two 10 s windows).

The title screen and the menu (70-255 s) start none, and they run at 0.6-2 presents per second either way. The opening scene runs at 1.1-2.6 presents per second. The build without this change stops before that point, so this cost cannot be compared directly. Device VRAM in use stays at 12.4-12.7 GB from 75 s to the end of every run with this change, with no growth.

Tested

Linux 7.2.14, AMD Radeon RX 9070 XT, RADV (Mesa 26.2.6), Release with tests.

Checklist

# Conflicts:
#	core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_native_multisample_depth_tests.cmake
#	core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
# Conflicts:
#	core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
#	core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_native_multisample_depth_tests.cmake
#	core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
…ing draw binds a published owner under pending storage units
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 15941 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp L1106-1107
PR 16880 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp L1103-1106

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 5925 docs/dev/debt/libSceAgcDriver.md
PR 6186 docs/dev/debt/libSceAgcDriver.md
PR 6280 docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6481 docs/dev/debt/libSceAgcDriver.md
PR 6804 docs/dev/debt/libSceAgcDriver.md
PR 6808 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7085 docs/dev/debt/libSceAgcDriver.md
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7449 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8592 docs/dev/debt/libSceAgcDriver.md
PR 9335 docs/dev/debt/libSceAgcDriver.md
PR 9356 docs/dev/debt/libSceAgcDriver.md
PR 9387 docs/dev/debt/libSceAgcDriver.md
PR 9508 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9895 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9950 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10049 docs/dev/debt/libSceAgcDriver.md
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10249 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 10351 docs/dev/debt/libSceAgcDriver.md
PR 10359 docs/dev/debt/libSceAgcDriver.md
PR 11444 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 11551 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 11825 docs/dev/debt/libSceAgcDriver.md
PR 12904 docs/dev/debt/libSceAgcDriver.md
PR 13809 docs/dev/debt/libSceAgcDriver.md
PR 13863 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13920 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13928 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13929 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 14344 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 14944 docs/dev/debt/libSceAgcDriver.md
PR 15136 docs/dev/debt/libSceAgcDriver.md
PR 15456 docs/dev/debt/libSceAgcDriver.md
PR 15529 docs/dev/debt/libSceAgcDriver.md
PR 15548 docs/dev/debt/libSceAgcDriver.md
PR 15621 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 16025 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 16054 docs/dev/debt/libSceAgcDriver.md
PR 16483 docs/dev/debt/libSceAgcDriver.md
PR 17024 docs/dev/debt/libSceAgcDriver.md
PR 17056 docs/dev/debt/libSceAgcDriver.md
PR 17524 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 17611 docs/dev/debt/libSceAgcDriver.md
PR 17788 docs/dev/debt/libSceAgcDriver.md
PR 17796 docs/dev/debt/libSceAgcDriver.md
PR 17899 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 18082 docs/dev/debt/libSceAgcDriver.md
PR 18101 docs/dev/debt/libSceAgcDriver.md
PR 18102 docs/dev/debt/libSceAgcDriver.md
PR 18139 docs/dev/debt/libSceAgcDriver.md
PR 18155 docs/dev/debt/libSceAgcDriver.md
PR 18390 docs/dev/debt/libSceAgcDriver.md
PR 18455 docs/dev/debt/libSceAgcDriver.md
PR 18515 docs/dev/debt/libSceAgcDriver.md
PR 19191 docs/dev/debt/libSceAgcDriver.md
PR 19620 docs/dev/debt/libSceAgcDriver.md

@Doorriiaann

Copy link
Copy Markdown
Contributor

An NVIDIA run, since the PR has AMD and lavapipe results only: RTX 3070 (8 GB), driver 610.57.04, Debian 13, kernel 6.12.115, GCC 13.3.0 Release, validation layer 1.4.335, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, the ctest -V -R pattern from Tested, 3 runs each.

merge-base f439f7f3a0 (main) this PR 3b3fefa541
tests 63, all passed 3/3 67, all passed 3/3 (the 63, the tests from #16363, #16364 and #16365, and agc_driver_native_depth_overwritten_published)
VUID- lines / layer not found 0 / 0 0 / 0

AI-assisted: yes

@hugodearaujo

Copy link
Copy Markdown
Contributor Author

@Doorriiaann Thanks for the NVIDIA run. It's also the first run where agc_storage_pending_key_refresh and agc_storage_clear_hand_over run on both sides; they skip on the RX 9070 XT. Your negative control matches mine: on 57f21b13b8 the case that keeps the owner passes, and the overwriting case then fails with an overwriting draw over a published owner under storage results did not start a new owner. I've added your run to Tested.

@JJenkx

JJenkx commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Windows GPU check of head 3b3fefa541, merged onto main e7c3bfd130 (23697f091e, clean merge). Run through the Windows FIFO, job 320ad0e16df6469597b2b2ab0f2b7c7c, exit 0 with cleanup verified.

Setup: Windows 11 Enterprise 22621, AMD Radeon RX 6700 XT (driver 32.0.21045.16010), WinLibs GCC 15.2 UCRT, Release, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1.

These five tests pass in 3 of 3 runs each, 15 of 15, none skipped:

  • agc_driver_native_multisample_depth
  • agc_driver_native_depth_pending_units
  • agc_driver_native_depth_overwritten_planes
  • agc_driver_native_depth_overwritten_published
  • agc_driver_native_depth_single_sample_view

All 408 test and .prx hashes matched the prepared build when the job started.

AI-assisted: yes.

@hugodearaujo

Copy link
Copy Markdown
Contributor Author

@JJenkx Thanks for the Windows run. It's the first on Windows and on an RDNA2 card. I've added it to Tested.

@hugodearaujo

Copy link
Copy Markdown
Contributor Author

#16363 and #16365 are merged, so I merged main c548802 into this branch (2fa9a5ff85, no force-push). This branch had both of them merged in already, in a different order, so three files conflicted:

The diff against main is now #16364's change and this PR's own.

With the validation layer, the same command as before (73 tests): 71 pass, agc_driver_native_depth_overwritten_published, agc_driver_native_depth_pending_units, agc_driver_native_depth_overwritten_planes and agc_driver_native_depth_single_sample_view among them, and the same 2 skip. The log has no VUID- line. check_conventions passes.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 10, 2026
@hugodearaujo

Copy link
Copy Markdown
Contributor Author

#16364 is merged, so I merged main 946133f into this branch (08ba519102, no force-push). This branch had #16364's commit under its own, merged with main in a different order than main merged it, so the merge applies this PR's own commit (35542ee9c7) onto main. Only DepthSurface.cpp conflicted: main has #16365's GuestHoldsSamples() after #16363's ProveOverwrite(), and this PR's PublishedUnderStorage() goes right after it, as in the previous merge. The diff against main is now this PR's own change alone, the same 133 added and removed lines as its commit.

With the validation layer, the same command as before (73 tests): 71 pass, agc_driver_native_depth_overwritten_published and #16364's agc_driver_native_depth_pending_units among them, and the same 2 skip. The log has no VUID- line. check_conventions passes.

@Lucke0051

Copy link
Copy Markdown
Contributor

Ran this PR merged onto main 1ee5cd7 (PR head 08ba519) on two Linux GPUs and compared with main on the same machine (CachyOS, Linux 7.3.1, gcc 16.2.1 Release). This adds an Intel GPU (Mesa's ANV) to the runs above.

GPU AGC, shader and VideoOut tests
NVIDIA GeForce RTX 3070 Ti, NVIDIA 615.78.08 no difference from main; the new test agc_driver_native_depth_overwritten_published passes 3 of 3 alone
Intel UHD Graphics 630 (CML GT2), Mesa 26.2.6 no difference from main; the new test agc_driver_native_depth_overwritten_published passes 3 of 3 alone
Failures main has too on this machine

Command: ANYPS5_GPU=<NVIDIA|UHD> ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build -j8 --timeout 120 -R '^(agc|video_out|shader)'; the new test alone with -R '^(agc_driver_native_depth_overwritten_published)$' -V. No validation layer installed here, so no VUID- comparison.

AI-assisted: yes (Claude ran the tests and drafted this comment)

@hugodearaujo

Copy link
Copy Markdown
Contributor Author

@Lucke0051 Thanks, and for the first Intel run on this one. No difference from main on either GPU, and agc_driver_native_depth_overwritten_published passes 3 of 3 alone on both. I've added it to Tested.

@github-actions github-actions Bot added the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Nov 14, 2026
@blawesom

Copy link
Copy Markdown
Contributor

Validation run — queue item 38 (AGC multisample depth owner / published owner under pending storage units)

Environment

Build

  • Configure: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_TESTING=ON → exit 0, wall 11 s (log q38-pr17890-configure.log).
  • Build: cmake --build build --parallel 12 (CMAKE_BUILD_PARALLEL_LEVEL=12, MAKEFLAGS=-j12) → exit 0, wall 325 s, 9030 targets (log q38-pr17890-build.log).

Focused test pattern

  • ctest --test-dir build -N in both trees; matched set = 141 agc tests whose names match multisample|depth|owner|publish|storage and that exist in BOTH trees (explicit alternation in q38-pattern.txt; name lists q38-pattern-base-matched.txt / q38-pattern-pr-matched.txt, diff empty → IDENTICAL matched set in both trees).
  • PR-only test agc_driver_native_depth_overwritten_published (registered only on the PR head) run separately on the PR tree: Passed (log q38-tests-pr-new-test.log). Base-only agc_storage_dcc_mip_writeback is a main-newer test absent from the PR branch base.

Test runs (identical env on both trees, timeout 3600 each)

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
VK_ADD_LAYER_PATH=/home/benj/scratch/vvl-layer VK_LOADER_DEBUG=layer ANYPS5_GPU='AMD Radeon RX 9070 XT' \
ctest --test-dir build -R '<pattern>' -V
  • Base (q38-tests-base.log): exit 0, wall 25 s — 100% tests passed out of 141 (138 Passed, 3 Skipped: agc_storage_pending_key_refresh, agc_storage_clear_hand_over, agc_idle_publish_wait).
  • PR (q38-tests-pr.log): exit 0, wall 25 s — 100% tests passed out of 141 (same 138 Passed, same 3 Skipped).
  • Per-test pass/fail/skip comparison: identical across all 141 tests (only sub-0.1 s timing differences).

Layer checks (per AGENTS.md)

  • was not found but was requested by env var VK_INSTANCE_LAYERS: ABSENT in both logs (0 occurrences).
  • Insert instance layer "VK_LAYER_KHRONOS_validation": PRESENT in both logs (173 lines each; 2 in the new-test log).

Validation-ID diff

  • VUID- IDs: none in either log. SYNC-HAZARD- IDs: none in either log. Bracketed [ VUID-... ] / [ SYNC-HAZARD-... ] IDs: none. Validation Error/Validation Warning lines: 0 in both logs.
  • Diff of ID sets base vs PR: empty — the change adds no new VUID- validation errors.

Push

  • git push fork +08ba519102bb32ea7d965591e704ca9e3420485b:refs/heads/validation/pr-17890 → created refs/heads/validation/pr-17890 on blawesom/AnyPS5 at the PR head SHA.

Verdict

PASS — build clean; 141/141 focused AGC multisample/depth/owner/publish/storage tests pass identically on base and PR head (same 3 skips); the PR's new test agc_driver_native_depth_overwritten_published passes; validation layer loaded in every run; no VUID-/SYNC-HAZARD diagnostics in either tree, so no new IDs attributable to the PR.

Limitations

  • Single run per tree (no repetition; intermittent faults not excluded). Scoped to Linux/AMD RADV (RX 9070 XT) with the Khronos validation layer; no other GPU/driver, no Windows. The base-only test agc_storage_dcc_mip_writeback (newer on main, absent from the PR branch base) was not part of the identical matched set. Logs retained under /home/benj/scratch/logs/ with prefix q38-.

@oneandonlydean
oneandonlydean merged commit 26f3f15 into boykopovar:main Nov 14, 2026
17 checks passed
@github-actions github-actions Bot removed the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Nov 14, 2026
oneandonlydean pushed a commit that referenced this pull request Nov 19, 2026
Keeps #17890's PublishedUnderStorage beside this branch's PublishToGuest(DepthReadCause) declaration, and #15059's SurfaceGuestBytes in the two storage image accesses that pass DepthReadCause::Reuse.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build docs unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants